import {Interaction} from './interaction.interface'
import { DomService } from '../dom.service'
import imgCompressor from '../clz/imgCompress'
export class IosService implements Interaction{
	private dom: DomService = new DomService()
	private window: any = this.dom.window
	login() {
		return new Promise((resolve,reject) => {
			resolve('asd')
		})
	}
	quit(){
		console.log('ios退出---')
		this.window.webkit.messageHandlers.closeWindow.postMessage('')
	}
	getcamera() {
		return ''
	}
	compressImage(options:{
		path:string,
		success:Function
	}){
		console.log('ios---------------')
		const compressor = new imgCompressor();
		compressor.compressByFile(options.path).then((res:any) => {
			options.success({
				tempFilePath:res
			})
		})
	}
}